package com.hq.ims.data.vo.statistics.statisticsEnum;

import com.hq.web.penum.IBaseEnum;

public enum EnumDimension implements IBaseEnum {

    Year(0, "年","%Y"),

    Month(1, "月","%Y-%m"),

    Day(2, "日","%Y-%m-%d"),

    ;

    private final int code;
    private final String typeName;
    private final String format;
    EnumDimension(int code, String typeName,String format) {
        this.code = code;
        this.typeName = typeName;
        this.format = format;
    }

    /**
     * 根据int类型转换枚举类
     *
     * @param x
     * @return com.hq.data.vo.statistics.statisticsEnum;.EnumDimension
     */
    public static EnumDimension getByInt(int x) {
        for (EnumDimension value : values()) {
            if (value.code == x) {
                return value;
            }
        }
        return null;
    }

    @Override
    public int getCode() {
        return code;
    }

    public String getTypeName() {
        return typeName;
    }

    public String getFormat() {
        return format;
    }

    @Override
    public String getValue() {
        return typeName;
    }
}
